<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            height: 1000px;
            background: greenyellow;
        }
    </style>
</head>
<body>

</body>
<script>
    document.addEventListener('scroll',function (){
        console.log(window.pageYOffset)
    })
</script>

</html>
